//
//  RotatingViewController.m
//  FinApp
//
//  Created by Victor Leandro Fernandez Rodrigo on 11/11/11.
//  Copyright (c) 2011 FIB-Fàcultat d'informàtica de Barcelona. All rights reserved.
//


#import "RotatingViewController.h"
#import "Defines.h"

@implementation RotatingViewController

@synthesize distaceLabel =			distaceLabel_;
@synthesize priceLabel =            priceLabel_;
@synthesize addressLabel =			addressLabel_;
@synthesize showRouteLabel =		showRouteLabel_;
@synthesize checkBoxImage =			checkBoxImage_;
@synthesize checkImage =			checkImage_;

@synthesize distanceString =		distanceString_;
@synthesize addressString =			addressString_;
@synthesize priceString =           priceString_;

- (void)dealloc {
	
	[distaceLabel_ release];		distaceLabel_ = nil;
	[addressLabel_ release];		addressLabel_ = nil;
    [priceLabel_ release];		priceLabel_ = nil;
	[showRouteLabel_ release];		showRouteLabel_ = nil;
	[checkBoxImage_ release];		checkBoxImage_ = nil;
	[checkImage_ release];			checkImage_ = nil;
	
	[distanceString_ release];		distanceString_ = nil;
	[addressString_ release];		addressString_ = nil;	
	
    [super dealloc];
	
}

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
	
    [super viewDidLoad];

	// Cadena del nombre y la distancia
	[priceLabel_ setText:priceString_];
	[distaceLabel_ setText:distanceString_];
    [distaceLabel_ setTextColor:[UIColor whiteColor]];
    [addressLabel_ setText:addressString_];	
		
	
	
	[showRouteLabel_ setText:NSLocalizedString(@"_rotating_view_show_route_label", @"")];
    [checkImage_ setHidden:YES];
	
}

#pragma mark -
#pragma mark Metodos definidos en la interfaz

- (IBAction)showPath:(id)sender {

	NSLog(@"showing Path");
	
	[checkImage_ setHidden:!checkImage_.hidden];
	
}

#pragma mark -
#pragma mark Metodos redefinidos

- (void)updateDistance:(double)newdistance {
	
	[super updateDistance:newdistance];
	
	self.distanceString = [NSString stringWithFormat:@"%f", newdistance];
	//NSLog(@"Updating Distance in RotatingViewController. New distance: %@", self.distanceString);
	[self.distaceLabel setText:distanceString_];
	
}

@end
